<?php
namespace ZfcUser\Model;

use Zend\Db\ResultSet\ResultSet;
use Zend\Db\TableGateway\TableGateway;
use Zend\Db\Sql;
use Zend\Db\Sql\Where;
use Zend\Db\Sql\Select;
use Zend\Paginator\Adapter\DbSelect;
use Zend\Paginator\Paginator;
class TstateTable
{
    protected $tableGateway;
	protected $select;
    public function __construct(TableGateway $tableGateway)
    {
        $this->tableGateway = $tableGateway;
		$this->select = new Select();
    }	
	public function getallstates()
    {		         
         $resultSet = $this->tableGateway->select();
		 return $resultSet;	        
    }
	public	function getBasedcountry($countryid){		
		$select = $this->tableGateway->getSql()->select()
				->where("country_id='".$countryid."'");
		$resultSet = $this->tableGateway->selectWith($select);		
        return $resultSet;
	}
	public	function getStateName($state_id){		
		$select = $this->tableGateway->getSql()->select()
				->where("state_id='".$state_id."'");
		$resultSet = $this->tableGateway->selectWith($select);		
        return $resultSet->current();
	}
	
}